/* eslint-disable */
import React from "react";
import Chart from "echarts-for-react";
import style from "./Echarts_tu.less";
import request from '../../../utils/request';


class Echarts_left5 extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            xianzhi:0,
            value:[],
            name:'',
            time:[],
            unit:'',
        }



    }

    componentDidMount() {
        request({
            url: `/sx-client/sx/indicator/productionEfficiencyAnalysis`,
            method: 'GET',
        }).then(data => {
            if(data.rc === 0) {
                this.setState({
                    value:data.ret.value,
                    name:data.ret.name,
                    time:data.ret.time,
                    unit:data.ret.unit
                })
            }
        })

    }




    setOption = () => {

        return {

            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
        
            // toolbox: {
            //     feature: {
            //         saveAsImage: {}
            //     }
            // },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'category',
                    boundaryGap: false,
                    data: this.state.time
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ],
            series: [
                {
                    name: this.state.name,
                    type: 'line',
                    // stack: '总量',
                    areaStyle: {},
                    data: this.state.value
                }

            ]
        };



    }

    render() {
        console.log(this.props)
        return (

            <Chart option={this.setOption()} notMerge lazyUpdate 
                style={{ height: '100%' }}
            />




        );
    }

}

export default Echarts_left5;
